package com.hnx.admin.system.vo.user;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/*
创建人： 倔强的头发
创建时间：2024/7/13
功能描述:

*/
@Data
public class UserDetailVO  implements UserDetails {
    private UserVO user;
    @Setter(AccessLevel.NONE)
    private String password;
    public UserDetailVO(){}
    public UserDetailVO(UserVO userVO){
        this.user = userVO;
    }
    public UserDetailVO(UserVO userVO,String password){
        this(userVO);
        this.password = password;
    }
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.user.getUsername();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
